//
// Created by f12160c on 2018/7/26.
//

#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

#include "leetcode/leetcode.hpp"

using namespace std;

int Solution::strStr(string haystack, string needle) {
    if(haystack.size() < needle.size()){
        return -1;
    }

    for(int i = 0; i <= haystack.size() - needle.size(); i++){
        if(needle == string(haystack, i, needle.size())){
            return i;
        }
    }

    return -1;
}
